<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDeployBusinessTypesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('deploy_business_types', function (Blueprint $table) {
            $table->integer('id')->unique()->comment('id');
            $table->tinyInteger('origin_type_id')->default(1)->comment('来源类型');
            $table->string('name')->default('')->comment('业务单据名称');
            $table->string('service')->default('')->comment('归属服务');
            $table->integer('parent_id')->default(0)->comment('父级业务单据');
            $table->string('table_name')->default('')->comment('数据表');
            $table->string('local_class')->default('')->comment('本地仓库类')->index();
            $table->string('remote_class')->default('')->comment('远程仓库类')->index();

            $table->tinyInteger('is_tenant_update')->default(0)->comment('租户是否改动');
            $table->integer('created_id')->default(0)->comment('创建人');
            $table->integer('updated_id')->default(0)->comment('修改人');
            $table->integer('created_at')->default(0)->comment('创建时间');
            $table->integer('updated_at')->default(0)->comment('修改时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('deploy_business_types');
    }
}
